package org.tis.tools.abf.module.jnl.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.tis.tools.abf.module.jnl.feign.ILogDataChangeAbfFeignService;
import org.tis.tools.model.common.ResultVO;
import org.tis.tools.model.log.LogDataChange;
import org.tis.tools.starter.mybatisplus.querykit.model.Query;

import javax.validation.constraints.NotBlank;

/**
 * Created by chenchao
 * Created on 2018/9/1 15:18
 */
@RestController
@RequestMapping("/logChange")
@Validated
public class LogDataChangeController {

    @Autowired
    private ILogDataChangeAbfFeignService logDataChangeAbfFeignService;

    @ApiOperation(value = "根据操作数据GUID分页查询日志差异值",notes = "传入分页数据,和操作数据GUID(guidData)值作为参数")
    @PostMapping("/pageByDataId")
    public ResultVO page(@RequestBody @Validated Query<LogDataChange> query) {
        return logDataChangeAbfFeignService.page(query);
    }

    @ApiOperation(value = "根据GUID查询日志差异值",notes = "传入guid作为参数")
    @GetMapping("/{id}")
    public ResultVO detial(@PathVariable @NotBlank(message = "guid不能为空") String id) {
        return logDataChangeAbfFeignService.detial(id);
    }
}
